package net.sk.china.city.talk.model.system;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 系统菜单表
 * +----------------------------------------------------------------------
 * | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2018-2024 聊来All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * +----------------------------------------------------------------------
 * | @Author: 聊来 <18970881148@qq.com>
 * +----------------------------------------------------------------------
 * | DateTime: 2024/6/2 15:26
 * +----------------------------------------------------------------------
 */

@Data
@TableName("db_city_menu")
public class CityMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "父级ID")
    private Integer pid;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "icon")
    private String icon;

    @ApiModelProperty(value = "权限标识")
    private String perms;

    @ApiModelProperty(value = "组件路径")
    private String component;

    @ApiModelProperty(value = "类型，M-目录，C-菜单，A-按钮")
    private String menuType;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "显示状态")
    private Boolean isShow;

    @ApiModelProperty(value = "是否删除")
    private Boolean isDelete;

    @ApiModelProperty(value = "创建时间")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;

    public static CityMenu newDemoSystemMenu() {
        CityMenu cityMenu = new CityMenu();
        cityMenu.setId(123);
        cityMenu.setPid(0);
        cityMenu.setName("测试");
        cityMenu.setIcon("xxxxx");
        cityMenu.setPerms("user:management:list");
        cityMenu.setComponent("");
        cityMenu.setMenuType("A");
        cityMenu.setSort(1);
        cityMenu.setIsShow(true);
        cityMenu.setIsDelete(false);
        cityMenu.setCreateTime(LocalDateTime.now());
        cityMenu.setUpdateTime(LocalDateTime.now());
        return cityMenu;
    }


    public static CityMenu newDemoSystemMenu2() {
        CityMenu cityMenu = new CityMenu();
        cityMenu.setId(123);
        cityMenu.setPid(0);
        cityMenu.setName("测试");
        cityMenu.setIcon("xxxxx");
        cityMenu.setPerms("activity:management:list");
        cityMenu.setComponent("");
        cityMenu.setMenuType("A");
        cityMenu.setSort(1);
        cityMenu.setIsShow(true);
        cityMenu.setIsDelete(false);
        cityMenu.setCreateTime(LocalDateTime.now());
        cityMenu.setUpdateTime(LocalDateTime.now());
        return cityMenu;
    }

}
